package com.meme.editor.gui.sprite2d;


import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JScrollPane;

import org.apache.log4j.Logger;

import com.meme.app.AppRegistry;
import com.meme.editor.EntityObject;
import com.meme.editor.model.sprite2d.PureModuleGroup;
import com.meme.editor.gui.EntityChildrenListView;
import com.meme.editor.gui.PropertyEditPanel;


public class PureModuleContentPanel extends JPanel
{
	static Logger logger = Logger.getLogger (PureModuleContentPanel.class);
	
	JSplitPane mSplitPane_Children;
	JSplitPane mSplitPane_Main;
	JSplitPane mSplitPane_Editor;

	
	
	public PureModuleContentPanel (PureModuleGroup imageModuleGroup)
	{
		
		int width  = ( (Integer) AppRegistry.getRegistry("editor.sprite2d.contentPanel.width") ).intValue();
		int height = ( (Integer) AppRegistry.getRegistry("editor.sprite2d.contentPanel.height") ).intValue();
		
		ModuleGroupPanel editView = new ModuleGroupPanel (imageModuleGroup, ModuleGroupPanel.ViewMode_Bird, ModuleGroupPanel.EditMode_ImageModule, false);
		ModuleGroupPanel iconsView = new ModuleGroupPanel (imageModuleGroup, ModuleGroupPanel.ViewMode_Icons, ModuleGroupPanel.EditMode_ImageModule, false);
		
		EntityChildrenListView childrenView = new EntityChildrenListView (imageModuleGroup);
		
		PropertyEditPanel modulePropertyPanel = new PropertyEditPanel ();
		childrenView.setPropertyEditPanel (modulePropertyPanel);
		
		editView.setChildrenListView(childrenView);
		

		

		
		//		mSplitPane_Children = new JSplitPane (JSplitPane.VERTICAL_SPLIT, 
//				childrenView, 
//        		modulePropertyPanel 
//                );
//		mSplitPane_Children.setResizeWeight (1.0);
//		mSplitPane_Children.setDividerSize  (2);
//		mSplitPane_Children.setDividerLocation (height * 2 / 3);
//		
//		mSplitPane_Editor = new JSplitPane (JSplitPane.VERTICAL_SPLIT, 
//        		editView, 
//        		iconsView
//        		);		
//		mSplitPane_Editor.setResizeWeight (1.0);
//		mSplitPane_Editor.setDividerSize  (5);
//		mSplitPane_Editor.setDividerLocation (width * 3 / 4);
//		
//		mSplitPane_Main = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT, 
//				mSplitPane_Editor, 
//        		mSplitPane_Children );		
//		mSplitPane_Main.setResizeWeight (1.0);
//		mSplitPane_Main.setDividerSize  (5);
//		mSplitPane_Main.setDividerLocation (width * 2 / 3);
		
		mSplitPane_Children = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT, 
				iconsView, 
				modulePropertyPanel 
        		);
		mSplitPane_Children.setResizeWeight (1.0);
		mSplitPane_Children.setDividerSize  (2);
		mSplitPane_Children.setDividerLocation (width / 2);

		mSplitPane_Editor = new JSplitPane (JSplitPane.VERTICAL_SPLIT, 
				mSplitPane_Children, 
				editView
				);		
		mSplitPane_Editor.setResizeWeight (0.0);
		mSplitPane_Editor.setDividerSize  (5);
		mSplitPane_Editor.setDividerLocation (width / 4);

		mSplitPane_Main = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT, 
				mSplitPane_Editor, 
				childrenView 
				);		
		mSplitPane_Main.setResizeWeight (1.0);
		mSplitPane_Main.setDividerSize  (5);
		mSplitPane_Main.setDividerLocation (width * 2 / 3);		

		setLayout ( new BorderLayout() );
		add (mSplitPane_Main, BorderLayout.CENTER);
	}

}
